#include <iostream>
#include <unistd.h>
#include <pthread.h>

void *thread1(void *argv)
{
    int cut1 = 10;
    while (cut1)
    {
        std::cout << "child thread pid: " << getpid() << argv << std::endl;
        cut1--;
        sleep(1);
    }
    return (void *)100;
}

int main()
{
    pthread_t pth1_id;

    int pth1_ret = pthread_create(&pth1_id, NULL, thread1, (void *)"thread1_name");
    int cut1 = 10;
    while (cut1)
    {
        std::cout << "parent thread pid: " << getpid() << std::endl;
        cut1--;
        sleep(1);
    }
    void *ch1;
    pthread_join(pth1_id, &ch1);
    cut1 = 10;
    while (cut1)
    {
        std::cout << "parent thread return: " << (int *)ch1 << std::endl;
        cut1--;
        sleep(1);
    }
    return 0;
}
